/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.nextsql.renderizar;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Properties;
import java.util.TreeSet;

/**
 *
 * @author rho
 */
public class OrdenadorProperties {
    public void OrdenarProperties(Properties properties, String arquivo, String comentario){
        Properties prop = new Properties(){
            @Override
            public synchronized Enumeration<Object> keys(){
                return Collections.enumeration(new TreeSet<Object>(super.keySet()));
            }
        };
        prop.putAll(properties);
        try{
            FileOutputStream file = new FileOutputStream(arquivo);
            prop.store(file, comentario);
            file.close();
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}
